package com.cimr.comm.controller;

import com.cimr.comm.aop.FullPage;
import com.cimr.comm.po.User;
import com.cimr.comm.service.UserService;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * Created by liqi on 2017/8/1.
 */
@Controller
@RequestMapping("/")
public class LoginController {
    @FullPage(menu = "")
    @RequestMapping({"index","nav/index"})
    public ModelAndView index(HttpServletRequest req, HttpServletResponse resp, ModelMap data) {
        User user = userService.getByUsername("tom");
        return new ModelAndView("index");
    }

    @FullPage(menu = "")
    @RequestMapping({"login"})
    public ModelAndView login(HttpServletRequest req, HttpServletResponse resp, ModelMap data) {
        return new ModelAndView("comm/login/login", data);
    }

    @Resource
    private UserService userService;
}
